package com.xw.unification.annotations;

import org.springframework.http.MediaType;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 统一响应处理配置注解, Controller Method 优先级高于 Controller
 *
 * @author qiwei
 * @date 2023-8-9 21:00:00
 * @since v1.0.0
 */
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
public @interface UnifiedResponse {

    /**
     * 响应体编码格式
     *
     * @return String
     */
    String characterEncoding() default "utf-8";

    /**
     * 响应体文本类型
     *
     * @return String
     */
    String contentType() default MediaType.APPLICATION_JSON_VALUE;

    /**
     * 是否保留原响应体, true 为保留
     *
     * @return boolean
     */
    boolean nativeBody() default false;

}
